package tech.yangzhijie.login.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import tech.yangzhijie.login.service.MenuService;
import tech.yangzhijie.login.vo.EasyUiTree;
import tech.yangzhijie.login.vo.UserVo;

import javax.servlet.http.HttpSession;
import java.util.List;



@Controller
@RequestMapping("menu")
public class MenuController {

	@Autowired
	private MenuService menuService;
	
	@RequestMapping("/findMenuList")
	@ResponseBody
	public List<EasyUiTree> findMenuList(HttpSession session, @RequestParam(value="id",defaultValue="1") Integer id){
		UserVo userVo = (UserVo)session.getAttribute("user");
		userVo.setPmid(id);
		return menuService.findMenuList(userVo);
	}
}
